﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace AutomationAdmin.ViewModels
{
    public class RequestNew
    {
        public enum ReqStatus
        {
            NotStarted, Cancelled, InProgress, Halted, Completed
        }

        public enum LiveEmbargo
        {
            Live, Embargo
        }

        public class Update
        {
            public Update()
            {
                Date = DateTime.Now;
            }

            public DateTime Date { get; set; }
            public ReqStatus Status { get; set; }
            public string UpdatedBy { get; set; }
        }

        public RequestNew()
        {
            Status = ReqStatus.NotStarted;
            Date = DateTime.Now;
            Updates = new List<Update>();
        }

        public ReqStatus Status { get; set; }

        [Display(Name="Date")]
        public DateTime Date { get; set; }

        [Display(Name = "Contact Name")]
        [Required]
        public string ContactName { get; set; }

        [Display(Name = "Email")]
        [Required]
        public string Email { get; set; }

        [Display(Name = "Bureau Name")]
        [Required]
        public string BureauName { get; set; }

        [Display(Name = "Sector", Description = "e.g. Treasury Energy")]
        [Required]
        public string Sector { get; set; }

        [Display(Name = "Automation Name", Description = "e.g. Swedish trade balance")]
        [Required]
        public string AutomationName { get; set; }

        [Display(Name = "Key Timing")]
        [Required]
        public bool KeyTiming { get; set; }

        [Display(Name = "Business Justification", Description = "competitive edge, man hours saved etc")]
        [Required]
        public string BusinessJustification { get; set; }

        [Display(Name = "Frequency")]
        [Required]
        public string Frequency { get; set; }

        [Display(Name = "AutomationUsage", Description = "Will the program be started, run, and monitored each time by someone or do you expect it to run as an unattended process?")]
        [Required]
        public string AutomationUsage { get; set; }

        [Display(Name = "Source", Description = "e.g. CD, Internet, IDN, Email")]
        [Required]
        public string Source { get; set; }

        [Display(Name = "Source Details", Description = "RICs, URLs, Document type. Example of source data and corresponding alerts/stories/tables.")]
        [Required]
        public string SourceDetails { get; set; }

        [Display(Name = "LiveOrEmbargo")]
        [Required]
        public LiveEmbargo LiveOrEmbargo { get; set; }

        [Display(Name = "Output Details 1", Description = "eg Snap, Table")]
        public string OutputDetails1 { get; set; }

        [Display(Name = "Output Details 2", Description = "Will the data be published to Kobra or into another application?")]
        public string OutputDetails2 { get; set; }

        [Display(Name = "Output Details 3", Description = "Product, named item, topic codes")]
        public string OutputDetails3 { get; set; }

        [Display(Name = "Output Details 4", Description = "Will RICs be updated or referenced? ")]
        public string OutputDetails4 { get; set; }

        [Display(Name = "Output Details 5", Description = "Provide template of snap format")]
        public string OutputDetails5 { get; set; }

        [Display(Name = "Language Input")]
        public string LanguageInput { get; set; }

        [Display(Name = "Language Output")]
        public string LanguageOutput { get; set; }
        
        public IList<Update> Updates { get; set; }

        public Update LastUpdate 
        {
            get
            {
                if (Updates.Count > 0)
                    return Updates[Updates.Count - 1];
                return null;
            }
        }

    }
}
